import service from '@/utils/packagingRequest.js'

export const getTodayPackagesQuantilityApi = () => {
    return service({
        url: '/packagingToday',
        method: 'post',
    })
}

export const getCurrentWarnMsg = () => {
    return service({
        url: '/getWarnMsg?total=15',
        method: 'get',
    })
}

export const getTodayWarnMsgNum = () => {
    return service({
        url: '/warnNum',
        method: 'post',
    })
}

export const getCategory = () => {
    return service({
        url: '/getCategory',
        method: 'post',
    })
}

export const getPerformanceApi = () => {
    return service({
        url: '/getServiceIndex',
        method: 'post',
    })
}

// 要传一个参数name，post请求。
export const getStockByNameApi = (name) => {
    return service({
        url: '/findStock',
        method: 'post',
        data: {
            name: name
        }
    })
}

export const loginApi = (username, password) => {
    return service({
        url: '/login',
        method: 'post',
        data: {
            username: username,
            password: password
        }
    })
}

export const resetStockTime2Api = (name, stockWidth, addLength,sheet,operatorAccount) => {
    return service({
        url: '/resetStockTime2',
        method: 'post',
        data: {
            name: name,
            stockWidth: stockWidth,
            addLength: addLength,
            sheet:sheet,
            operatorAccount:operatorAccount,
        }
    })
}

export const findStockRemindLength01Api = (name) => {
    return service({
        url: '/findStockSymbol',
        method: 'post',
        data: {
            name: name
        }
    })
}


export const getTodayPackagesQuantilityByNameApi = (userId, customer) => {
    return service({
        url: '/getTodayByName',
        method: 'post',
        data: {
            userId: userId,
            customer: customer
        }
    })
}

export const getWarmMsgByIdApi = (total, id) => {
    return service({
        url: '/findWarnMsgById',
        method: 'post',
        data: {
            total: total,
            id: id
        }
    })
}

export const getOpRecordsApi = () => {
    return service({
        url: '/getOperationRecords?total=10',
        method: 'get',
    })
}

export const findStockByNameApi = (name) => {
    return service({
        url: '/findStockByName',
        method: 'post',
        data: {
            name: name
        }
    })
}
export const findStockByNameFormApi = (name) => {
    return service({
        url: '/findStockByNameForm',
        method: 'post',
        data: {
            name: name
        }
    })
}

export const CorrectStockApi = (name, stockWidth, addLength,sheet,operatorAccount,sheetRemain) => {
    return service({
        url: '/correctStockInventory',
        method: 'post',
        data: {
            name: name,
            stockWidth: stockWidth,
            addLength: addLength,
            sheet:sheet,
            operatorAccount:operatorAccount,
            remainingSheets:sheetRemain,
        }
    })
}

export const getOverHaulApi =(name)=>{
    return service({
        url: '/getOverHaul',
        method: 'post',
        data: {
            name: name,
        }
    })
}

export const getPartInApi = () => {
    return service({
        url: '/getPartsIn',
        method: 'post',
    })
}
export const createPartsInApi = (partNumber,partName,sku,customer) => {
    return service({
        url: '/createPartsIn',
        method: 'post',
        data: {
            partNumber: partNumber,
            partName: partName,
            sku: sku,
            location:customer,
        }
    })
}
export const updatePartsInApi = (partNumber,partName,sku,operatorAccount,customer) => {
    return service({
        url: '/updatePartsIn',
        method: 'post',
        data: {
            partNumber: partNumber,
            partName: partName,
            sku: sku,
            operatorAccount:operatorAccount,
            location:customer,
        }
    })
}


export const getPartInApiByName = (name) => {
    return service({
        url: '/getPartsInByName',
        method: 'post',
        data: {
            location: name
        }
    })
}